package com.hanoiwiki.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="CATEGORY")
public class Category extends BaseObject {
	
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	
	@Column(name="CATEGORY_NAME")
	private String categoryName;
	
	@Column(name="STATUS")
	private Integer status;
	
	@Column(name="PRIORITY")
	private Integer priority;
	
	@Column(name="DESCRIPTION")
	private String description;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<CategoryType> categoryTypes;
	
	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name="PLACE_CATEGORY", joinColumns={@JoinColumn(name="CAT_ID")}
								, inverseJoinColumns={@JoinColumn(name="PLACE_ID")})
	private List<Places> places;
	
	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name="PLACE_IN_QUEUED_CATEGORY", joinColumns={@JoinColumn(name="CAT_ID")}
								, inverseJoinColumns={@JoinColumn(name="PLACE_IN_QUEUED_ID")})
	private List<PlacesInQueued> placesInQueueds;
	
	
	public List<Places> getPlaces() {
		return places;
	}
	public void setPlaces(List<Places> places) {
		this.places = places;
	}
	public List<PlacesInQueued> getPlacesInQueueds() {
		return placesInQueueds;
	}
	public void setPlacesInQueueds(List<PlacesInQueued> placesInQueueds) {
		this.placesInQueueds = placesInQueueds;
	}
	
	public List<CategoryType> getCategoryTypes() {
		return categoryTypes;
	}
	public void setCategoryTypes(List<CategoryType> categoryTypes) {
		this.categoryTypes = categoryTypes;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getCategoryName() {
		return categoryName;
	}
	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public Integer getPriority() {
		return priority;
	}
	public void setPriority(Integer priority) {
		this.priority = priority;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
}
